import { ref } from 'vue'
import { defineStore } from 'pinia'

export const useUserStore = defineStore(
  'userInfo',
  () => {
    const userInfo = ref({
      id: '',
      name: '',
      password: '',
      email: '',
      phone: '',
      role: '',
    })
    const getUserInfo = () => userInfo.value
    const setUserInfo = (data) => {
      userInfo.value = data
    }
    return { userInfo, getUserInfo, setUserInfo }
  },
  {
    persist: true,
  },
)
